Skip to content

fix(profile): dispose stale ECharts instance in initEChart - #29

Merged
vahldiek merged 1 commit into
ReproDB:mainfrom
vahldiek:fix/profile-chart-stale-echarts
Jul 15, 2026
Merged

fix(profile): dispose stale ECharts instance in initEChart#29
vahldiek merged 1 commit into
ReproDB:mainfrom
vahldiek:fix/profile-chart-stale-echarts

Conversation

@vahldiek

Copy link
Copy Markdown
Member

Problem

On the profile page, switching from one person to another left the Contributions Over Time chart showing the previous person's series. For example, going to Anjo Vahldiek-Oberwagner (who has AE Committee Service) and then changing the name to Christian Rossow showed the same early "AE Committee Service" bars that belonged to Anjo.

Root cause

echarts.init(el) returns the existing instance already attached to a DOM node rather than a fresh one. The profile page re-calls initEChart on the same #timelineChart element on every profile switch, and renderContributionChart then calls setOption(...) with the default merge semantics. ECharts merges series by index, so when the new person has fewer series (e.g. only "Artifact Papers"), the previous person's higher-index series ("ArtiFinder (discovered)", "AE Committee Service") are never removed.

Fix

Dispose any pre-existing ECharts instance on the element inside initEChart before creating a new one, so every re-render starts from a clean slate. Because the fix is centralized in initEChart, it also resolves the same latent staleness for any other chart that re-renders on the same element (e.g. the ranking-history chart), and it preserves theming since the fresh instance re-applies the light/dark baseline. The wrapped dispose also disconnects the ResizeObserver, so there is no observer leak.

   R.initEChart = function(el) {
     if (typeof el === 'string') el = document.getElementById(el);
     if (!el) return null;
+    var existing = echarts.getInstanceByDom(el);
+    if (existing) existing.dispose();
     var chart = echarts.init(el, null, { renderer: 'canvas' });

Testing

  • Verified the data itself is correct (Adam Belay / others), so this was purely a client-side rendering-state bug.
  • After the change, switching profiles renders only the current person's series.

echarts.init reuses an existing instance on a DOM node, and setOption
merges by default, so switching profiles left a previous person's
Contributions Over Time series (e.g. AE Committee Service / ArtiFinder)
rendered for the next person. Dispose any pre-existing instance before
re-init so every render starts from a clean slate.
@vahldiek
vahldiek merged commit 0f14874 into ReproDB:main Jul 15, 2026
3 checks passed
@vahldiek
vahldiek deleted the fix/profile-chart-stale-echarts branch July 15, 2026 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant